/**
 * 扑克牌卡片
 */
class Card extends eui.Component{

	private img_front:eui.Image;
	private value:number;
	private cardsType:CardsType;
	private cardsValue:CardsValue;

	public constructor(type:CardsType,value:CardsValue) {
		super();
		this.skinName="CardSkin";
		this.cardsType =type;
		this.cardsValue = value;
		let v = "";
		if(value<=10){
			v = value.toString();
		}else if(value == CardsValue.J){
			v = "J";
		}else if(value == CardsValue.Q){
			v="Q";
		}else if(value == CardsValue.K){
			v="K";
		}
		this.img_front.source=RES.getRes(CardsType[type]+"_"+v+"_png");
		this.addEventListener(egret.TouchEvent.TOUCH_TAP,this.flop,this);
	}

	public get Type():CardsType{
		return this.cardsType;
	}

	public get Value():CardsValue{
		return this.cardsValue;
	}

    private flop():void{
		this.currentState = "front";
		console.log("touch flop");
	}

	public get Score():number{
		if(this.cardsValue<=10){
			return this.cardsValue;
		}
		if(this.cardsValue ==11 || this.cardsValue ==12 || this.cardsValue == 13){
			return 10;
		}
	}
	
}